package com.tj.pystandard.tjapi.rocketmq.controller;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * TO DO
 *
 * @author tangjing
 * @date 2021/12/20 11:16
 */
@RestController
@Api(tags = "rocketmq生产者")
@Slf4j
@RequestMapping("/rocketmq")
public class ProducerController {

    @Resource
    private RocketMQTemplate rocketMQTemplate;

    @PostMapping("/test")
    public String test() {
        rocketMQTemplate.convertAndSend(
                "ace-msg",
                "生活不止有苟且，还有诗和远方！");

        return "success";
    }
}
